#!/usr/bin/env sh
. "$(dirname -- "$0")/_/husky.sh"

npm run lint:sol:prettier
npm run lint:ts:prettier
npm run lint:sol
npm run lint:ts

# Prevent `it.only` or `describe.only` tests commited
if [ "$allowonlytests" != "true" ] &&
    test $(git diff --cached | grep -E "\b(it|describe).only\("  | wc -l) != 0
then
    cat <<\EOF
Error: Attempt to add it.only or describe.only - which may disable all other tests

If you know what you are doing you can disable this check using:

    git config hooks.allowonlytests true
EOF
    exit 1
fi
